package com.cxlin.cwanandroid.model.repository

import com.cxlin.base.model.api.BaseRepository
import com.cxlin.base.model.api.Result
import com.cxlin.cwanandroid.model.api.WanRetrofitClient
import com.cxlin.cwanandroid.model.bean.ArticleList
import com.cxlin.cwanandroid.model.bean.SystemParent

/**
 *
 * @Author: chenxunlin
 * @Date: 2024/4/30 15:05
 */
class SystemRepository : BaseRepository() {

    suspend fun getSystemTypes(): Result<List<SystemParent>> {
        return safeApiCall(
            call = { executeResponse(WanRetrofitClient.service.getSystemType()) },
            errorMessage = "网络错误"
        )
    }

    suspend fun getSystemTypeDetail(cid: Int, page: Int): Result<ArticleList> {
        return safeApiCall(
            call = { executeResponse(WanRetrofitClient.service.getSystemTypeDetail(page, cid)) },
            errorMessage = "网络错误"
        )
    }
}